package com.ruoyi.delivery.service.impl;

import com.ruoyi.delivery.domain.DelTransportDetail;
import com.ruoyi.delivery.mapper.DelTransportDetailMapper;
import com.ruoyi.delivery.service.IDelTransportDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DelTransportDetailServiceImpl implements IDelTransportDetailService {

    @Autowired
    private DelTransportDetailMapper transportDetailMapper;

    /**
     * 根据 trackingNumber 获取所有运单明细
     *
     * @param trackingNumber 运单号
     * @return 运单明细列表
     */
    @Override
    public List<DelTransportDetail> getDetailsByTrackingNumber(String trackingNumber) {
        return transportDetailMapper.getDetailsByTrackingNumber(trackingNumber);
    }

    @Override
    public List<DelTransportDetail> getDetailsByOrderNumber(String orderNumber) {
        return transportDetailMapper.getDetailsByOrderNumber(orderNumber);
    }



    /**
     * 插入运单明细
     *
     * @param detail 运单明细对象
     * @return 影响的行数
     */
    @Override
    public int insertTransportDetail(DelTransportDetail detail) {
        return transportDetailMapper.insertTransportDetail(detail);
    }

    /**
     * 删除运单明细
     *
     * @param transportDetailId 运单明细编号
     * @return 影响的行数
     */
    @Override
    public int deleteTransportDetail(String transportDetailId) {
        return transportDetailMapper.deleteTransportDetail(transportDetailId);
    }

    /**
     * 修改运单明细
     *
     * @param detail 运单明细对象
     * @return 影响的行数
     */
    @Override
    public int updateTransportDetail(DelTransportDetail detail) {
        return transportDetailMapper.updateTransportDetail(detail);
    }

    /**
     * 筛选运单明细
     *
     * @param trackingNumber 运单号
     * @param productName   商品名称
     * @param orderNumber   订单号
     * @param productBatch  商品批次
     * @return 符合条件的运单明细列表
     */
    @Override
    public List<DelTransportDetail> searchTransportDetails(String trackingNumber,String productName, String orderNumber, String productBatch) {
        return transportDetailMapper.searchTransportDetails(trackingNumber,productName, orderNumber, productBatch);
    }

}
